var currentIndexTemp = 0;
var date = "";
var indexTemp = 0;
var frame;

efform_onload = function ()
{
	date = date2String();
	$("#inqu_status-0-fdVirtualDate").val(date);
}; 

function date2String(){
    var datetime = new Date();
    var year = datetime.getFullYear();
    var month = datetime.getMonth() + 1 < 10 ? "0" + (datetime.getMonth() + 1) : datetime.getMonth() + 1;
    var date = datetime.getDate() < 10 ? "0" + datetime.getDate() : datetime.getDate();
    return year + "-" + month + "-" + date;
}

button_query_onclick = function () 
{   
	frame = 0;
	date = 	$("#inqu_status-0-fdVirtualDate").val();
	if(date == ""){
		date = date2String();
		$("#inqu_status-0-fdVirtualDate").val(date);		
	}
		
	var info = getDetail("ef_region_inqu","inqu_status");
	if (null != info){ 
		if(indexTemp=='0')
		{
			fundiv(0,0);
		
		}
		if(indexTemp=='1')
		{
			fundiv(1,1);
		
		}
		if(indexTemp=='2')
		{
			fundiv(2,2);
		
		}
		if(indexTemp=='3')
		{
			fundiv(3,3);
	
		}
		if(indexTemp=='4')
		{
			fundiv(4,4);
	
		}
		if(indexTemp=='5')
		{
			fundiv(5,5);
	
		}
		if(indexTemp=='6')
		{
			fundiv(6,6);
	
		}
		if(indexTemp=='7')
		{
			fundiv(7,7);
		}
		info.set("fdVirtualDate", date);
		EiCommunicator.send("ZMCG90", "query", info, query_callback);
    } 
}

var query_callback={
	onSuccess:function(eiInfo){
		if(eiInfo.getStatus()==-1){
			EFAlert("操作失败，原因："+eiInfo.getMsg());
		}
	},
	onFail:function(eMsg)
	{
		EFAlert("操作失败，原因："+eMsg); 
	}
}

function fundiv(currentIndex,index){ 
	currentIndexTemp = currentIndex;
	indexTemp = index;
	if(index ==0){  
		frame = frames[0];
	    frame.src = "DispatchAction.do?efFormEname=ZMCG91&fdVirtualDate="+date ;
		efform.setStatus(0, "正在加载...");
	}else if(index ==1){ 
		frame = frames[1];
	    frame.src = "DispatchAction.do?efFormEname=ZMCG92&fdVirtualDate="+date;
		efform.setStatus(0, "正在加载...");
	}else if(index ==2){ 
		frame = frames[2];
		frame.src = "DispatchAction.do?efFormEname=ZMCG94&fdVirtualDate="+date;
		efform.setStatus(0, "正在加载...");
	}else if(index ==3){
		frame = frames[3];
	    frame.src = "DispatchAction.do?efFormEname=ZMCG95&fdVirtualDate="+date;
		efform.setStatus(0, "正在加载...");
	}else if(index ==4){
		frame = frames[4];
		frame.src = "DispatchAction.do?efFormEname=ZMCG96&fdVirtualDate="+date;
		efform.setStatus(0, "正在加载...");
	}else if(index ==5){
		frame = frames[5];
		frame.src = "DispatchAction.do?efFormEname=ZMCG97&fdVirtualDate="+date;
		efform.setStatus(0, "正在加载...");
	}
} 

